package com.wrh.draw.layer;

import com.wrh.draw.bean.LonLat;
import com.wrh.draw.layer.shap.CircleMarker;
import com.wrh.draw.layer.shap.MarkerShape;

import java.awt.*;

/**
 * @author wrh
 */
public class MarkerLayer extends LonLatLayer {


    private final LonLat lonLat;

    /**
     * 设置默认 MarkerShape为圆形
     */
    private MarkerShape markerShape = new CircleMarker();


    public MarkerLayer(LonLat lonLat) {
        this.lonLat = lonLat;
    }

    public MarkerLayer(double lon, double lat) {
        this(LonLat.form(lon, lat));
    }

    public static MarkerLayer form(LonLat lonLat) {
        return new MarkerLayer(lonLat);
    }

    public static MarkerLayer form(double lon, double lat) {
        return MarkerLayer.form(LonLat.form(lon, lat));
    }

    public LonLat getLonLat() {
        return lonLat;
    }

    public MarkerLayer setShape(MarkerShape markerShape) {
        this.markerShape = markerShape;
        return this;
    }

    public void draw(Graphics2D g, Point p) {
        this.markerShape.draw(g, p);
    }
}
